app.controller('baseController',function($scope){
	//刷新页面
	$scope.reloadList=function(){
		$scope.search($scope.paginationConf.currentPage,$scope.paginationConf.itemsPerPage)
	}
	
              $scope.paginationConf = {
        			currentPage: 1,
        			totalItems: 10,
        			itemsPerPage: 10,
        			perPageOptions: [10, 20, 30, 40, 50],
        			onChange: function(){
        			 $scope.reloadList();//重新加载
        			}
        			};
        	
        	
        	$scope.selectIds=[];//选中的 ID 集合
            //更新复选
           $scope.updateSelection = function($event, id) {
          if($event.target.checked){//如果是被选中,则增加到数组
                $scope.selectIds.push( id);
               }else{
                 var idx = $scope.selectIds.indexOf(id);
               $scope.selectIds.splice(idx, 1);//删除
             }
           }
           
         //从集合中按照 key 查询对象
           $scope.searchObjectByKey=function(list,key,keyValue){
           for(var i=0;i<list.length;i++){
           if(list[i][key]==keyValue){
           return list[i];
           }
           }
           return null;
           }
           
})